package site.brood.common.core.exception;

import site.brood.common.core.web.AjaxCode;
import site.brood.common.core.web.AjaxJson;

/**
 * 业务异常
 */
public class ServiceException extends RuntimeException {

    /**
     * 错误码
     */
    private Integer code;

    /**
     * 错误提示
     */
    private String message;

    public ServiceException(String message){
        super(message);
        this.code = AjaxCode.ERROR.getCode();
        this.message = message;
    }

    public ServiceException(String message, Integer code)
    {
        this.message = message;
        this.code = code;
    }

    public ServiceException(Throwable e)
    {
        super(e.getMessage(), e);
    }

    public String getMessage()
    {
        return message;
    }

    public Integer getCode()
    {
        return code;
    }
}
